<?php

namespace app\datacenter\model;

use app\BaseModel;
use think\Model;

/**
 * 设备模型
 */
class MemberCost extends BaseModel
{
    protected $connection = 'iot';

    protected $table = 'member_cost';

    //获取设备当日出袋数
    public static function getMeberCost(string $mac_id): int
    {
        $date = strtotime(date("Y-m-d 0:0:0"));
        return self::where(['mac_id' => $mac_id])
            ->where('cost_time', '>', $date)
            ->count();

    }
}